<template>
	<div class="tem-card">
        <ht-wd-list :tableData="tableData" :type="type" @add="addShow=true" @del="del" />
        
		<addtowntalk v-if="addShow" :addShow.sync="addShow" @rush="rush"></addtowntalk>
	</div>
</template>

<script>
import addtowntalk from './comment/addtowntalk_list.vue';
import { GttowntalkList, DetowntalkList } from '@/api/towntalk';

export default {
	name: 'towntalk_list',
	data() {
		return {
			tableData: [],
            type: 'towntalk',
			multipleSelection: [],
			addShow: false,
		};
	},
	components: {
		addtowntalk,
	},
	created() {
		this.Gttowntalklists();
	},
	activated() {
		this.Gttowntalklists();
	},
	methods: {
		// toggleSelection(rows) {
		// 	if (rows) {
		// 		rows.forEach((row) => {
		// 			this.$refs.multipleTable.toggleRowSelection(row);
		// 		});
		// 	} else {
		// 		this.$refs.multipleTable.clearSelection();
		// 	}
		// },
		// handleSelectionChange(val) {
		// 	this.multipleSelection = val;
		// },
		async Gttowntalklists() {
			try {
				this.tableData = await GttowntalkList();
			} catch (err) {
				console.log(err);
			}
		},
		rush() {
			this.Gttowntalklists();
		},
		async del(id) {
			try {
				await DetowntalkList(id);
				this.$message.success('删除成功');
				this.Gttowntalklists();
			} catch (err) {
				console.log(err);
			}
		},
	},
	mounted() {},
	computed: {},
	watch: {},
};
</script>

<style scoped>
.card {
	padding: 20px;
}

.table {
	padding-top: 20px;
}

.tag_label {
	border-radius: 14px;
}
</style>
